package com.riche.usercenter.once;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

import com.riche.usercenter.model.domain.User;
import com.riche.usercenter.service.UserService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;

import javax.annotation.Resource;

/**
 * @ClassName: InsertUsers
 * @Description: 定时任务插入用户信息
 * @Author: Gaoruiqi
 * @Date: 2025-09-03 21:08
 * @Version: 1.0
 **/
@Component
public class InsertUsers {

    @Resource
    private UserService userService;

    /**
     * 插入用户
     */
/*    @Scheduled(fixedDelay = Long.MAX_VALUE)
    public void doInsertUsers() {
        // todo spring的小插件，测量时间
        StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        final int INSERT_NUM = 100000;
        List<User> users = new ArrayList<>();
        for (int i = 0; i < INSERT_NUM; i++) {
            User user = new User();
            user.setUsername("假瑞奇");
            user.setUserAccount("fakeruiqi");
            user.setAvatarUrl("https://b0.bdstatic.com/ugc/9TZTnf7wpJBYaWYjVslJCA1a6b5079eefbedc2e4d51e981b7e6c25.jpg");
            user.setGender(0);
            user.setUserPassword("12345678");
            user.setPhone("13135467897");
            user.setEmail("234443634@qq.com");
            user.setUserStatus(0);
            user.setUserRole(0);
            user.setIsDelete(0);
            user.setTags("[]");
            user.setProfile("111111111111111");
            users.add(user);
        }
        userService.saveBatch(users, 1000);
        stopWatch.stop();
        System.out.println(stopWatch.getTotalTimeMillis());
    }*/
}
